package com.asdan.seededu;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;



//获得当前日期时间
public class Calenda {
	
	public Timestamp getNowTimeAli() {
		 Timestamp dateTime = null;
		try {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
			String s = formatter.format(curDate);// util类型
		    dateTime = Timestamp.valueOf(s);
			return dateTime;
		}catch(Exception e) {
			e.printStackTrace();
		}
		return dateTime;
	}

	public Date getNowTime() {
		 Date dateTime = null;
		try {
			Date curDate = new Date(System.currentTimeMillis());   // 获取当前时间
			return curDate;
		}catch(Exception e) {
			e.printStackTrace();
		}
		return dateTime;
	}
	
	public static  String getyyyymmdd(){
		Date nowTime=new Date(); 
		System.out.println(nowTime); 
		SimpleDateFormat time=new SimpleDateFormat("yyyy-MM-dd"); 
		System.out.println(time.format(nowTime)); 
		return time.format(nowTime) ;
	}
	
	public static  String getyyyymmddHHmmss(){
		Date nowTime=new Date(); 
		System.out.println(nowTime); 
		SimpleDateFormat time=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		System.out.println(time.format(nowTime)); 
		return time.format(nowTime) ;
	}

}
